<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>

<style>
	#register_page .dashboard-info-right{width:250px;padding: 0 6px 5px 7px;}
	.jquery-safari-checkbox{float:left;}
</style>

<form action="<?php echo site_url('registration/submit_step1');?>" name="user_form" id="user_form" method="post" enctype="multipart/form-data" >

<div class="home-escort-list" style="position:relative;" id="register_page">
	<span style="line-height:30px;"><?php echo language_translate('registration_page_escort_registration');?></span>
	
	<table>
	<tr>
		<td width="50%">
			<div class="dashboard-info-wrapper">
				<div class="dashboard-info-left">
					<span><?php echo language_translate('registration_page_user_name');?></span>
					<div class="help-text" title="<?php echo language_translate('registration_page_user_name_hint');?>"></div>
				</div>
				<div class="dashboard-info-right">
					<div class="select-box">
						<input type="text" name="username" id="username" value="" maxlength="45" class="text-box2">
						<div class="clear"></div>
						<div class="input-error" id="username_err"></div>
					</div>
				</div>
				<div class="clear"></div>
			</div>	
			
			<div class="dashboard-info-wrapper">
				<div class="dashboard-info-left">
					<span><?php echo language_translate('registration_page_email');?></span>
					<div class="help-text" title="<?php echo language_translate('registration_page_email_hint');?>"></div>
				</div>
				
				<div class="dashboard-info-right">
					<div class="select-box">
						<input type="text" name="email" id="email" value="" maxlength="45" class="text-box2">
						<div class="clear"></div>
						<div class="input-error" id="email_err"></div>
					</div>
				</div>
				<div class="clear"></div>
			</div>
			
			<div class="dashboard-info-wrapper">
				<div class="dashboard-info-left">
					<span><?php echo language_translate('borncountry_label');?></span>
					<div class="help-text" title="<?php echo language_translate('borncountry_label_hint');?>"></div>
				</div>
				
				<div class="dashboard-info-right">
					<div class="select-box">
						<?php echo form_dropdown("borncountry_id",getBornCountryData_ioc(),array(),"id='borncountry_id' class='custom' ");?>
					</div>
				</div>
				<div class="clear"></div>
			</div>
			
			<div class="dashboard-info-wrapper">
				<div class="dashboard-info-left">
					<span><?php echo language_translate('registration_page_category');?></span>
					<div class="help-text" title="<?php echo language_translate('registration_page_category_hint');?>"></div>
				</div>
				<div class="dashboard-info-right">
					<div class="select-box">
						<?php 
							echo form_dropdown('category_id', getSiteCategoryBaseOnSiteSetting(), array() , 'id="category_id" class="custom"' );
							//getEscortCategoryData_ioc()
						?>
					</div>
				 </div>
				<div class="clear"></div>
			</div>
			
			<div class="dashboard-info-wrapper">
				<div class="dashboard-info-left">
					<span><?php echo language_translate('registration_page_name');?></span>
					<div class="help-text" title="<?php echo language_translate('registration_page_name_hint');?>"></div>
				</div>
				<div class="dashboard-info-right">
					<div class="select-box">
						<input type="text" name="name" id="name" value="" maxlength="45" class="text-box2">
						<div class="clear"></div>
						<div class="input-error" id="name_err"></div>
					</div>
				</div>
				<div class="clear"></div>
			</div>	
			
			<div class="dashboard-info-wrapper">
				<div class="dashboard-info-left">
					<span><?php echo language_translate('registration_page_phone');?></span>
					<div class="help-text" title="<?php echo language_translate('registration_page_phone_hint');?>"></div>
				</div>
				<div class="dashboard-info-right">
					<div class="select-box">
						<input type="text" name="phone" id="phone" value="" maxlength="15" class="text-box2">
						<div class="clear"></div>
						<div class="input-error" id="phone_err"></div>
					</div>
				</div>
				<div class="clear"></div>
			</div>	
			
			<div class="dashboard-info-wrapper">
				<div class="dashboard-info-left">
					<span><?php echo language_translate('registration_page_address');?></span>
					<div class="help-text" title="<?php echo language_translate('registration_page_address_hint');?>"></div>
				</div>
				<div class="dashboard-info-right">
					<div class="select-box">
						<input type="text" name="address" id="address" value="" maxlength="45" class="text-box2">
						<div class="clear"></div>
						<div class="input-error" id="address_err"></div>
					</div>
				</div>
				<div class="clear"></div>
			</div>	
			
			<div class="dashboard-info-wrapper">
				<div class="dashboard-info-left">
					<span><?php echo language_translate('registration_page_country');?></span>
					<div class="help-text" title="<?php echo language_translate('registration_page_country_hint');?>"></div>
				</div>
				<div class="dashboard-info-right">
					<div class="select-box">
						<?php echo form_dropdown('country_id', getCountryData_ioc(), array() , 'id="country_id" class="custom"' );?>
					</div>
				 </div>
				<div class="clear"></div>
			</div>
			
			<div class="dashboard-info-wrapper">
				<div class="dashboard-info-left">
					<span><?php echo language_translate('registration_page_state');?></span>
					<div class="help-text" title="<?php echo language_translate('registration_page_state_hint');?>"></div>
				</div>
				<div class="dashboard-info-right">
					<div class="select-box" id="slb_state_id">
						<?php echo form_dropdown('state_id', getStateData_ioc(), array() , 'id="state_id" class="custom"' );?>
					</div>
					<?php echo loader_image_s('id="slb_state_id_loader" class="hidden"');?>
				 </div>
				<div class="clear"></div>
			</div>
			
			<div class="dashboard-info-wrapper">
				<div class="dashboard-info-left">
					<span><?php echo language_translate('registration_page_province');?></span>
					<div class="help-text" title="<?php echo language_translate('registration_page_province_hint');?>"></div>
				</div>
				<div class="dashboard-info-right">
					<div class="select-box" id="slb_province_id" >
						<?php echo form_dropdown('province_id', getProvinceData_ioc(), array() , 'id="province_id" class="custom"' );?>
					</div>
					<?php echo loader_image_s('id="slb_province_id_loader" class="hidden"');?>
				 </div>
				<div class="clear"></div>
			</div>
			
			<div class="dashboard-info-wrapper">
				<div class="dashboard-info-left">
					<span><?php echo language_translate('registration_page_city');?></span>
					<div class="help-text" title="<?php echo language_translate('registration_page_city_hint');?>"></div>
				</div>
				<div class="dashboard-info-right">
					<div class="select-box" id="slb_city_id">
						<?php echo form_dropdown('city_id', getCityData_ioc(), array() , 'id="city_id" class="custom"' );?>
					</div>
					<?php echo loader_image_s('id="slb_city_id_loader" class="hidden"');?>
				 </div>
				<div class="clear"></div>
			</div>
			
			<div class="dashboard-info-wrapper">
				<div class="dashboard-info-left">
					<span><?php echo language_translate('registration_page_commercial');?></span>
					<div class="help-text" title="<?php echo language_translate('registration_page_commercial_hint');?>"></div>
				</div>
				<div class="dashboard-info-right">
					<div class="select-box">
						<?php echo form_dropdown('commercial_id', getCommercialData_ioc(), array() , 'id="commercial_id" class="custom"' );?>
					</div>
				 </div>
				<div class="clear"></div>
			</div>
			
			<div class="dashboard-info-wrapper">
				<div class="dashboard-info-left">
					<span><?php echo language_translate('registration_page_captcha');?></span>
					<div class="help-text" title="<?php echo language_translate('registration_page_captcha_hint');?>"></div>
				</div>
				<div class="dashboard-info-right">
					<div class="select-box">
						<div id="captcha-section">
							<?php echo newCaptcha();?> 
						</div>	
						<div id="captcha-reload"></div>
						<div class="clear"></div>
						<input type="text" name="captcha" id="captcha" value="" maxlength="45" class="text-box2" style="margin-top:5px;">
						<div class="clear"></div>
						<div class="input-error" id="captcha_err"></div>
					</div>
				</div>
				<div class="clear"></div>
			</div>
			
			<div class="dashboard-info-wrapper">
				<div class="dashboard-info-left">
					&nbsp;
				</div>
				<div class="dashboard-info-right">
					<div class="select-box">
						<input type="checkbox" rel="checked" name="termandconditions" id="termandconditions" class="custom" />
						<a href="<?php echo site_url('news/page/terms_conditions');?>"><?php echo language_translate('registration_page_term_conditions');?></a>
					</div>
				 </div>
				<div class="clear"></div>
			</div>
			
			<div class="dashboard-info-wrapper">
				<div class="dashboard-info-left"><span>&nbsp;</span></div>
				<div class="dashboard-info-right">
					<div class="select-box">
						<input type="submit" class="save-button" value="<?php echo language_translate('registration_page_signup');?>" /> 
						<?php echo loader_image("id='loader_image' class='hidden'");?>
					</div>
				 </div>
				<div class="clear"></div>
			</div>	 
		</td>
		<td width="50%" style="vertical-align:top;padding-top:10px;padding-left:15px;">
			<?php $this->load->view('banner/register_page_banner',array('pos'=>'register_page') ); ?>
		</td>
	</tr>
	</table>
</div>

</form>

<!--
<div class="bottom-content-wrapper">
	<?php //$this->load->view('news/list_news',array('pos'=>'register') ); ?>
</div>
-->
<div class="bottom-content-wrapper">
	<?php $this->load->view('banner/bottom_banner',array('pos'=>'register_page') ); ?>
</div>
		
		
<script type="text/javascript">
	$(document).ready(function() {
		var options = { 
			beforeSubmit:  validateB4Submit,  
			success:       processAfterResponding   
		};	
		$('#user_form').ajaxForm(options); 
		
		$('#country_id').live('change',function(){
			changeCountry_slb($('#country_id').val());
		});
		$('#state_id').live('change',function(){
			changeState_slb($('#state_id').val(),$('#country_id').val());
		});
		$('#province_id').live('change',function(){
			changeProvince_slb($('#state_id').val(),$('#province_id').val(),$('#country_id').val());
		});
		
		$('.help-text[title]').qtip({ style: { name: 'dark', tip: true } });
		 
		$('#termandconditions').bind('click',function(){termAndCondition();});
		
	});	
	google.setOnLoadCallback(function() {termAndCondition();});
	
	function changeCountry_slb($country_id){
		$('#slb_state_id, #slb_province_id, #slb_city_id').html('<select class="custome"></select>');
		$('select.custome').customStyle();
		$('#slb_state_id_loader, #slb_province_id_loader, #slb_city_id_loader').show();
		$.post(BASE_URI+'registration/changeCountry_async',{country_id:$country_id},function(res){
			$('#slb_state_id_loader').hide();
			$('#slb_state_id').html(res);
			$('select#state_id').customStyle();
			$firtElementValue = $('#state_id').children().first().val();
			changeState_slb($firtElementValue,$country_id);
		});
	}
	
	function changeState_slb($state_id,$country_id){
		$('#slb_province_id, #slb_city_id').html('<select class="custome"></select>');
		$('select.custome').customStyle();
		$('#slb_province_id_loader, #slb_city_id_loader').show();
		$.post(BASE_URI+'registration/changeState_async',{state_id:$state_id,country_id:$country_id},function(res){
			$('#slb_province_id_loader').hide();
			$('#slb_province_id').html(res);
			$('select#province_id').customStyle();
			$firtElementValue = $('#province_id').children().first().val();
			changeProvince_slb($state_id,$firtElementValue,$country_id);
		});
	}
	
	function changeProvince_slb($state_id,$province_id,$country_id){
		$('#slb_city_id').html('<select class="custome"></select>');
		$('select.custome').customStyle();
		$('#slb_city_id_loader').show();
		$.post(BASE_URI+'registration/changeProvince_async',{state_id:$state_id,province_id:$province_id,country_id:$country_id},function(res){
			$('#slb_city_id_loader').hide();
			$('#slb_city_id').html(res);
			$('select#city_id').customStyle();
		});
	}

	function termAndCondition(){
		if($('#termandconditions').attr('rel')== 'checked'){
			$('.save-button').css({'background-color':'#cfcfcf'});
			$('#termandconditions').attr('rel','');
		}
		else{
			$('.save-button').css({'background-color':'#1e1f1f'});
			$('#termandconditions').attr('rel','checked');
		}
	}
		
	function validateB4Submit(formData, jqForm, options){
		$('#loader_image').show();
		$('#username_err, #email_err, #name_err, #phone_err, #address_err').html('');
		if(! $('#termandconditions').is(':checked')){
			$('#loader_image').hide();	
			return false;	
		}
		return true;
	}

	function processAfterResponding(responseText, statusText, xhr, $form) {
		$('#loader_image').hide();	
		if(responseText == 'ok'){
			queryurl( BASE_URI+'registration/signin_notify' );
		}else{
			var arr_res = responseText.split('#');
			for(i in arr_res){
				var e = arr_res[i].split('|');
				$('#'+e[0]).html(e[1]);
			}
		}
	}

</script>		
		